home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-30 | 5.4 KB | 130 lines | [TEXT/CWIE] |
- // ===========================================================================
- // LAGAPushButton.h
- // ===========================================================================
- // “Apple Grayscale Appearance” compliant (almost) Push Button
- // Copyright © 1996 Chrisoft (Christophe ANDRES) All rights reserved.
- //
- // You may use this source code in any application (commercial, shareware, freeware,
- // postcardware, etc), but not remove this notice (no need to acknowledge the use of
- // this class in the about box)
- // You may not sell this source code in any form. This source code may be placed on
- // publicly accessable archive sites and source code disks. It may not be placed on
- // profit archive sites and source code disks without the permission of the author,
- // Christophe ANDRES.
- //
- // This source code is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- //
- // If you make any change or improvement on this class, please send the improved/changed
- // version to : chrisoft@calva.net or Christophe ANDRES
- // 20, rue Prosper Mérimée
- // 67100 STRASBOURG
- // FRANCE
- //
- // ===========================================================================
- // LAGAPushButton.cp <- double-click + Command-D to see class implementation
- //
- // LAGAPushButton is my implementation of the “Apple Grayscale Appearance for System 7.5”
- // Push Buttons with the exception of the pressed state. The pressed state is my own kind,
- // because I (and my customers) found it nicer than Apple's ;-)
- //
- // if mRadioBehavior is set, the Push Button acts as a RadioButton and can be used with
- // a radio group
- //
- // This class requires AGAColors.cp to be present in your project
- //
- // Version : 1.2
- //
- // Change History (most recent first, date in US form : mm/dd/yy):
- //
- // 06/30/96 ca Public release of version 1.2
- // 06/04/96 ca Added static RegisterClass for easier class registration
- // Added guard macros in header files
- // made changes to allow the usage of either the standard button template or the custom LAGAPushButton
- // template. The standard button template is easier for layout because you can see the text, but you
- // can't control the checkbox behavior of the button, which is possible from the custom template
- // Defined class_ID1 and CreateAGAPushButtonStream1 to handle the two template possibilities
- // Added a CPPb to "LAGAPushButton CPPb.rsrc" called LAGAPushButton1 to handle the standard button
- // template, without having to tinker the class ID
- // Increased version to 1.2
- // 05/15/96 ca Increased version to 1.1
- // Replaced mTextTraitsH by mTextTraitsID, to simplify, text traits management
- // Inlined and adapted SetTextTraitsID and GetTextTraitsID
- // Added copy constructor
- // Added "on the fly" constructor
- // Added change history
- // 04/??/96 jhs Improvements sent by James H. Stein <steinj@best.com>
- // Added SetTextTraitsID and GetTextTraitsID
- // Added missing includes (for those who do not use the "classic" PP prefix)
- // 04/22/96 ca class made available by Christophe ANDRES <chrisoft@calva.net>
- // (version 1.0)
- //
- // To Do:
- //
-
- #ifndef _H_LAGAPushButton
- #define _H_LAGAPushButton
- #pragma once
-
- #include <LControl.h>
- #include <LString.h>
-
- class LAGAPushButton : public LControl
- {
- public :
- enum { class_ID = 'AGA7', class_ID1 = 'AgA7' };
- static void RegisterClass (); // <06/04/96 ca>
- static LAGAPushButton* CreateAGAPushButtonStream (LStream *inStream);
- static LAGAPushButton* CreateAGAPushButtonStream1 (LStream *inStream); // <06/04/96 ca>
-
- LAGAPushButton ();
-
- LAGAPushButton (LStream *inStream, Boolean inCreateWithStandardButton = false); // <06/04/96 ca>
-
- LAGAPushButton (const LAGAPushButton &inOriginal); // <05/13/96 ca>
-
- LAGAPushButton (const SPaneInfo &inPaneInfo, MessageT inClickedMessage, ResIDT inTextTraitsID, // <05/13/96 ca>
- Str255 inTitle, Boolean inRadioButtonBehavior);
-
- virtual void SetValue (Int32 inValue);
-
- virtual StringPtr GetDescriptor (Str255 outDescriptor) const;
-
- virtual void SetDescriptor (ConstStringPtr inDescriptor);
-
- // <04/??/96 jhs> <05/15/96 ca>
- virtual void SetTextTraitsID (ResIDT inTextTraitsID) { mTextTraitsID = inTextTraitsID; mStyleCache = -1; };
-
- // <04/??/96 jhs> <05/15/96 ca>
- virtual ResIDT GetTextTraitsID () { return(mTextTraitsID); };
-
- protected :
- virtual void HotSpotResult (Int16 inHotSpot);
-
- virtual void HotSpotAction (Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
-
- virtual void DrawSelf ();
-
- virtual void DrawAll (Boolean inPushed);
-
- virtual void DrawGraphic (Boolean inPushed);
-
- virtual void DrawText (Boolean inPushed);
-
- virtual void DisableSelf () { Refresh(); };
-
- virtual void EnableSelf () { Refresh(); };
-
- LStr255 mTitle;
- ResIDT mTextTraitsID; // <05/15/96 ca>
- Int16 mStyleCache; // <05/15/96 ca> Here, we cache the style information needed for italic adjustment
-
- Boolean mRadioBehavior;
-
- private:
- static char mCorners[3][4][4][4];
- };
-
- #endif
-